﻿// Author:					HungNM
// Created:					27-07-2012
// Last Modified:			27-07-2012
//

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Web;
using eProject.Data;

namespace eProject.Business
{
    public class SiteUser
    {
        #region Public Properties

        public static bool IsUserManagement
        {
            get { return IsPermission("IsUserManagement"); }
        }

        #endregion

        #region Private Method

        private static bool IsPermission(string PermissionName)
        {
            if (HttpContext.Current == null || HttpContext.Current.User == null) { return false; }
            UserHelper userHelper = UserHelper.Instance;
            List<Permissions> listPermissions = userHelper.User.ListPermistions;
            foreach (Permissions permission in listPermissions)
            {
                if (PermissionName.Equals(permission.PermissionName))
                    return true;
            }

            return false;
        }

        #endregion

        #region Public Method

        public static Users getCurrentUser()
        {
            UserHelper userHelper = UserHelper.Instance;
            return userHelper.User;
        }

        #endregion
    }
}
